<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>

<style type="text/css">
<!--
.STYLE1 {color: #CC0000}
.STYLE2 {color: #3366FF}
.STYLE3 {color: #FF9900}
.STYLE4 {color: #339900}
.STYLE5 {color: #000000}
-->
</style>
</head>

<body>
	<div id="main">
		<div id="navigation">当前位置：<a href="<?php echo $this->projectUrl(array('action'=>'list','controller'=>'source')) ;?>">Source列表</a>  &gt; 查看排期 SourceId：'<?php echo $this->sourceId;?>' &nbsp;&nbsp;SourceSubId：'<?php echo $this->sourceSubId;?>'<br />
		 
          <div id="search">
					  <form id="editForm" name="editForm" method="post" action="">
              <select name="year" id="year">
                            <?php for($i=2008;$i<=2014;++$i):?>
                            <option value="<?php echo $i;?>"
                            <?php if($this->year==$i):?> 
                            selected="selected"
                            <?php endif;?>
                            ><?php echo $i.'年';?></option>
                            <?php endfor;?>
			            </select>
					      &nbsp;
					      <select name="month" id="month">
                          <?php for($j=1;$j<=12;++$j):?>
                          <option value="<?php echo $j;?>"
                          <?php if($this->month==$j):?>
                          selected="selected"
                          <?php endif;?>
                          ><?php echo $j.'月';?></option>
                          <?php endfor;?>
				          </select>
					      &nbsp;&nbsp;
					      <input type="submit" name="button" id="button" value="查询" class="button" />
			              <br />
					      
					  </form></div></div>
<div id="body">
			<div id="edit">

              <form id="listForm" name="listForm" method="post" action="">
              <table bgcolor="#FFFFFF" bordercolor="#cccccc" border="1px">
              <tr>
              <td>周日</td>
              <td>周一</td>
              <td>周二</td>
              <td>周三</td>
              <td>周四</td>
              <td>周五</td>
              <td>周六</td>
              </tr>
              <?php $dayi=0;$day=1;?>
              <?php for($k=1;$k<=$this->line;++$k):?>
              <tr>
               <?php for($o=1;$o<=7;++$o):?>
               <?php if((($k-1)*7+$o-1)<$this->weekday || $day+$dayi>$this->day):?>
                <td style="width:200px; height:100px;">&nbsp;</td>
                <?php else:?>
                <td style="width:200px; height:80px; padding:5px; " align="left" valign="top" ><?php echo  $this->dateRow['day']=$day+$dayi; echo '日';
				$dayi++;
				?>
                <?php $rows=$this->model->getSchedualRows($this->dateRow);?>
                <?php if(count($rows)):?>
              
                 <?php foreach($rows as $rowSche):?>  
                
                 <div style="padding:5px;background-color:<?php echo $rowSche['bgcolor'];?>; border:5px; height:70PX; "> 
                 <input name="selectId[]" type="checkbox"  class="selectCheckBox" value="<?php echo $rowSche['id'];?>" />
                
                 <br />
                 支付方式：<?php echo $rowSche['paymentMethod'];?><br />
                 <?php if($rowSche['paymentMethod']!="免费"):?>
                 金额：<?php echo round($rowSche['price'],3);?>
                 <?php endif;?>
                 </div>
                 <?php endforeach;?>
                <?php endif;?>                </td>
                <?php endif;?>
               
               <?php endfor;?>
              </tr>
              <?php endfor;?>
          
              </table>
              
              <table class="controlTable">
						<tr>
							<td align="left"> 
                                        <input type="button" name="all" id="all" value="全选" class="button" onclick="$('.selectCheckBox').attr('checked', true);"/>
                                        <input type="button" name="cancel" id="cancel" value="取消" class="button" onclick="$('.selectCheckBox').attr('checked', false);"/>
                                        <input type="submit" name="deleteBtn" id="deleteBtn" value="删除选中" class="button" onclick="return del();"/>
                          </td>
							 <td colspan="6" class="paginator"><div align="right"></div></td>
		  </tr>
			    </table>
              </form>
			</div>
		</div>
</div>
<script>
$(function(){
$("#useAs").change(function(){
  if($(this).val()=="YEK"){
  		//YEK类型
		
		//默认选到广告类型
		$("#isHaveAd option").each(function(){
			if($(this).val=="1"){
				$(this).attr("selected","selected");
			}
			else
			{
				$(this).removeAttr("selected");
			}
		})
		
				//默认为免费
		$("#paymentMethod option").each(function(){
		  if($(this).val()=="CPA")
		  {
		  	$(this).attr("selected","selected");
		  }
		  else
		  {
			$(this).removeAttr("selected");
		  }
		})
		
		//显示价格
		$(".SchePrice").show();
  } else {
  		//客户类型
		
		//默认为客户类型
		$("#isHaveAd option").each(function(){
			if($(this).val()=="0")
			{
				$(this).attr("selected","selected");
			}
			else
			{
				$(this).removeAttr("selected");
			}
		})
		
		//默认为免费
		$("#paymentMethod option").each(function(){
		  if($(this).val()=="免费")
		  {
		  	$(this).attr("selected","selected");
		  }
		  else
		  {
			$(this).removeAttr("selected");
		  }
		})
		
		
		//隐藏价格
		$("#price").val(0.000);
		$(".SchePrice").hide();
  }	
})

$("#isHaveAd").change(function(){
 if($(this).val()=="1")
  {
    //选择CPA为默认收费凡是
	$("#paymentMethod option").each(function(){
		if($(this).val()=='CPA') {
		  $(this).attr("selected","selected");
		}
		else
		{
		 $(this).removeAttr("selected");
		}
	})
	$(".SchePricePrice").show();
 }
 else
 {
   //选择免费为收费方式且设置金额为0
   	$("#paymentMethod option").each(function(){
		if($(this).val()=='免费') {
		  $(this).attr("selected","selected");
		}
		else
		{
		 $(this).removeAttr("selected");
		}
	})
	
	$("#price").val(0.000);
	$(".SchePricePrice").hide();
     
 }

})

$("#paymentMethod").change(function(){
 if($(this).val()=="免费"){
 	$("#price").val(0.000);
	$(".SchePricePrice").hide();
 }
 else
 {
	$(".SchePricePrice").show();
 }
})
	

$("#useAs").change();

})





</script>

<script language="javascript">
function del()
{
	if (confirm('确定删除吗？')) {
		$("#listForm").attr('action', '<?php echo $this->projectUrl(array('action'=>'delete')) ;?>');
		$("#listForm").submit();
		return true;
	} else {
		return false;
	}
}
</script>
</body>
</html>